function* foo(){
    console.log("代码开始执行")

    const value1 = 100
    try {
        yield value1
    } catch (error) {
        console.log("俘获到异常情况:",error)
    }
   

    console.log("第二段代码继续执行")
    const value2 = 1000
    yield value2

    console.log("代码执行结束")
}

const generator = foo()
console.log(generator.next())
console.log(generator.throw("error message"))